home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Testing & Debugging / VUAssist 1.0d10 / VUAssist Source Code / UVUAssist.inc1.p < prev    next >
Encoding:
Text File  |  1991-09-10  |  11.1 KB  |  361 lines  |  [TEXT/MPS ]

  1. (*+
  2.  *    File:        UVUAssist.inc1.p
  3.  *
  4.  *    Contains:    VU assistance header - MacApp 3.0b2PQR compatible version
  5.  *
  6.  *    Written by:    David Shayer
  7.  *
  8.  *    Copyright:    © 1991 by Apple Computer, Inc., all rights reserved.
  9.  *
  10.  *  Version: 1.0d10
  11.  *
  12.  *    Change History (most recent first):
  13.  
  14.          9/10/91    JAS        indicate 3.0b2PQR compatibility, change version
  15.          8/21/91    JAS        Change version
  16.          8/15/91    JAS        Remove kIncludeGridItems
  17.          8/14/91    JAS        Change CUSTOM_ITEM value to -1
  18.          8/13/91    JAS        Add CUSTOM_ITEM, kVUAssistIdleFreq, and kIncludeGridItems definitions
  19. -*)
  20.  
  21. {Historical Note:  References to the "Mole" are equivalent to references to "Agent VU".
  22. "Agent VU" was previously called the "Mole".}
  23.  
  24.  
  25. { ----------------- VUAssist proc data structures --------------------}
  26. { The following data structures and constants are not used by the mole. They're
  27. defined for the benefit of the MacApp VUAssist routine. }
  28.  
  29. TYPE
  30.  
  31. ViewItems = 
  32. (    
  33.     VINotMember,        { not a control or dialog item }
  34.     VIButton,             { TButton - this is the first control }
  35.     VIRadio,             { TRadio }
  36.     VICheckBox,         { TCheckBox }
  37.     VIScrollBar,        { TScrollBar or TSScrollBar - this is the last control }
  38.     VIPopup,             { TPopup }
  39.     VIStatText,         { TStaticText - from here on are dialog items only}
  40.     VIEditText,            { TEditText or TNumberText }
  41.     VIIcon,             { TIcon }
  42.     VIPicture,            { TPicture }
  43.     VITextEdit,            { TTEView or TDialogTEView }
  44.     VIGridItem            { cell of a TGridView }
  45. );
  46.  
  47.  
  48. CONST
  49.  
  50.     kVUAssistIdleFreq        = 1;    {This is the idle frequency of VUAssist.  By default this
  51.                                      is set to give VUAssist a very high idle frequency.  Even
  52.                                      though VUAssist does nothing with this idle time, this 
  53.                                      ensures that SystemTask will be called frequently while
  54.                                      the context of the application is the current context.  In
  55.                                      short, this enables Agent VU, which operates at SystemTask
  56.                                      while the app's context is current, to operate at maximum
  57.                                      efficiency.  This maximizes V.U. performance.  If, for some
  58.                                      reason, you would like to let the app. sleep for longer
  59.                                      periods of time, you can increase this value or, better yet,
  60.                                      call gVUAssist.SetIdleFreq with the new frequency.  Note, 
  61.                                      however, that this will cause V.U. to run more slowly against 
  62.                                      the application.}
  63.  
  64.  
  65. { ==================================================================}
  66.   
  67. { ----------------- General Mole data structures --------------------}
  68. { The following data structures are used by Agent VU (the Mole). }
  69.   
  70. TYPE  
  71.  
  72. MoleSelectors = 
  73. (
  74.     SStatus, 
  75.     GoOff, 
  76.     ComeOn, 
  77.     SBlock, 
  78.     PBlock, 
  79.     SBlkSize, 
  80.     SMouse,
  81.     PMouse,
  82.     EntKey,
  83.     SMenuInfo,            
  84.     SMenuItems,            
  85.     SetMItemKey,        
  86.     SFrontWind,            
  87.     SFindWind,            
  88.     SWindInfo,            
  89.     SFindCtl,            
  90.     SCtlInfo,            
  91.     SFindDItem,            
  92.     SDItemInfo,            
  93.     SResPeek,
  94.     SyncSBlock,
  95.     SNextEvent,
  96.     SHBlock,
  97.     PMouseString,
  98.     SIconHeight,
  99.     EmptyDeferred,
  100.     EndSelect
  101. );
  102.  
  103. MoleError = 
  104. (
  105.     mNoErr,
  106.     mUnknownSelector,
  107.     mAlreadyOnline,
  108.     mDeferredKilled,
  109.     mOtherVUHost,
  110.     mBadAddress,
  111.     mBadHandle,
  112.     mBadBlockSize,
  113.     mNoKbdDrvr,
  114.     mBigFail,
  115.     mBadTarget,
  116.     mNoCall,
  117.     mNoPendingTask,
  118.     mAppNotFound,
  119.     mNoAppInfo,
  120.     mDriverDeferred,
  121.     mBadDItemIndex,
  122.     mBadItemHdl,
  123.     mCursBusy,
  124.     mBadMenuRank,
  125.     mBadMenuID,
  126.     mBadMenuItemIndex,
  127.     mBadLastMenuItemIndex,
  128.     mHandleTooBig,
  129.     mEndErr
  130. );
  131.  
  132.  
  133. { ----------------- Window related data structures --------------------}
  134.  
  135. CONST
  136.     { used in the valid flags field }
  137.     { The valid flags field reflects which of the traits ( fields ) the Mole was able
  138.     to fill in accurately. }
  139.     VKIND            = 0;
  140.     VWRECT            = 1;        
  141.     VRANK            = 2;
  142.     VFLAGS            = 3;
  143.     VVARIANT        = 4;
  144.     VCTLCOUNT        = 5;
  145.     VTITLE            = 6;
  146.     VALERTP            = 7;
  147.     VITEMCNT        = 8;
  148.     VITEMLIST        = 9;
  149.     VPART            = 10;
  150.     VKIND_MASK        = $0001;
  151.     VRECT_MASK        = $0002;
  152.     VRANK_MASK        = $0004;
  153.     VFLAGS_MASK        = $0008;
  154.     VVARIANT_MASK    = $0010;
  155.     VCTLCNT_MASK    = $0020;
  156.     VTITLE_MASK        = $0040;
  157.     VITEMCNT_MASK    = $0080;
  158.     VPART_MASK        = $0100;
  159.     VALL_W_MASK        = $007F;
  160.     VALL_D_MASK        = $00FF;
  161.  
  162.     MWD_TITLE_LEN    = 64;
  163.  
  164.     UNSPECIFIED_RANK = -1;
  165.  
  166. TYPE
  167.     SendFindWindowParam = Point;    { point to test, in global coords }
  168.     SendFindWindowParamPtr = ^SendFindWindowParam;
  169.  
  170.     DWindReqPtr = ^integer;            { this isn't a real mole type, I made it up. }
  171.  
  172.     { This is the format of the Output buffer for SWindInfo calls. }
  173.     MoleWindowDescriptor = RECORD
  174.         validFlags:        integer;    { which of the following have valid data }
  175.         windowKind:        integer;    { as in window record - standard, dialog,
  176.                                        system, alert }
  177.         portRect:        Rect;        { as in window's grafport }
  178.         structRect:        Rect;        { boundary rect of struct rgn - global coords }
  179.         contentRect:    Rect;        { boundary rect of content region - global coords }
  180.         windowPart:        integer;    { returned by some calls }
  181.         windowRank:        integer;    { rank in window list, 1->N }
  182.         windowFlags:    integer;    { visible, hilited, go-Away, spare }
  183.         windowVariant:    integer;    { variation code extracted from high byte of
  184.                                        window defproc handle }
  185.         controlCount:    integer;    { how many controls in the control list }
  186.         numItems:    integer;        { number of items in item list }
  187.         {  The title field either has a pointer to the window title as a pascal string,
  188.            or the text of the window title extending off into the buffer }
  189.         CASE integer OF    
  190.             1: (text_ptr: ^SignedByte);
  191.             2: (text: SignedByte);
  192.             3: (text_name: Str255);    { this type is not defined by the mole, 
  193.                                     its here for the convenience of Pascal programmers,
  194.                                     who can't cast anything into anything. }
  195.     END;
  196.     MoleWDescPtr = ^MoleWindowDescriptor;
  197.     
  198.  
  199. { ----------------- Control related data structures --------------------}
  200.  
  201. CONST
  202.     
  203.     VCWINDOW            = 0;
  204.     VCRECT                = 1;
  205.     VCVALUE                = 2;
  206.     VCMIN                = 3;
  207.     VCMAX                = 4;
  208.     VCHILITE            = 5;
  209.     VCPART                = 6;
  210.     VCRANK                = 7;
  211.     VCTITLE                = 8;
  212.     VCWINDOWRANK_MASK    = $0001;
  213.     VCRECT_MASK            = $0002;
  214.     VCVALUE_MASK        = $0004;
  215.     VCMIN_MASK            = $0008;
  216.     VCMAX_MASK            = $0010;
  217.     VCHILITE_MASK        = $0020;
  218.     VCPART_MASK            = $0040;
  219.     VCRANK_MASK            = $0080;
  220.     VCVARIANT_MASK        = $0100;
  221.     VCTITLE_MASK        = $0200;
  222.     VALL_C_MASK            = $03FF;
  223.  
  224.     { standard CDEF IDs }
  225.     POPUP_CDEF            = 63;
  226.  
  227. TYPE
  228.     SendFindControlParam = Point;    { point to test, in global coords }
  229.     SendFindControlParamPtr = ^SendFindControlParam;
  230.  
  231.     { This is the format of the Input buffer for SCtlInfo calls. }
  232.     SendControlInfoParams = RECORD 
  233.         control_rank        :integer;        { rank in control list }
  234.         window_rank            :integer;        { rank of owning window amongst visible windows }
  235.     END;
  236.     SendCtlInfoParamsPtr = ^SendControlInfoParams;
  237.  
  238.     { This is the format of the Output buffer for SCtlInfo calls. }
  239.     MoleControlDescriptor = RECORD            { mole control descriptor }
  240.         validFlags            :integer;        { which of the following have valid data }
  241.         owner_rank            :integer;        { rank of owning window amongst visible windows }
  242.         ctlRect                :Rect;            { The ctl fileds are copied from the }
  243.         ctlValue            :integer;        {  control record }
  244.         ctlMin                :integer;
  245.         ctlMax                :integer;
  246.         ctlHilite            :integer;
  247.         part                :integer;        { filled in on some calls }
  248.         ctlRank                :integer;        { rank in owning window's control List }
  249.         ctlDefID            :integer;        { variation code from def proc handle }
  250.         popupMenuID            :integer;        { resource ID of popup menu }
  251.         { Referring to the Note on Descriptor and Info Records above ( see Marks menu ),
  252.            the title field either has a pointer to the control title as a pascal string,
  253.            or the text of the control title extending off into the buffer }
  254.         CASE integer OF 
  255.             1: (text_ptr: ^SignedByte);
  256.             2: (text_buf: SignedByte);
  257.             3: (text_name: Str255);    { this type is not defined by the mole, 
  258.                                     its here for the convenience of Pascal programmers. }
  259.     END;
  260.     MoleCDescPtr = ^MoleControlDescriptor;
  261.  
  262.  
  263. { ----------------- Dialog related data structures --------------------}
  264.  
  265. CONST
  266.     btnCtrlItem    = 4;
  267.     chkCtrlItem    = 5;
  268.     radCtrlItem    = 6;
  269.     resCtrlItem    = 7;
  270.  
  271.     RANK_OF_THE_INVISIBLE = -2;
  272.     CUSTOM_ITEM              = -1;        {special constant for items which do no fit into any
  273.                                      of the other content item categories}
  274.  
  275.  
  276. TYPE
  277.     SendDItemInfoParams = RECORD 
  278.         item_num            :integer;        { index in dialogs item list }
  279.         window_rank            :integer;        { rank of owning window amongst visible windows }
  280.     END;
  281.     SendDItemInfoPtr = ^SendDItemInfoParams;
  282.     
  283.     MoleDItemInfo = RECORD                  { mole dialog item info }
  284.         box                    :Rect;            { item bounding box }
  285.         ctlRank                :longint;         { if a control - then the control's rank in the control list }
  286.         itemType            :SignedByte;    { item type }
  287.         item_enabled        :Boolean;
  288.         has_text            :Boolean;
  289.         owner_rank            :integer;
  290.         item_num            :integer;
  291.         { Referring to the Note on Descriptor and Info Records above ( see Marks menu ),
  292.            the itemData field either has a pointer to the control title as a pascal string,
  293.            or the text of the control itemData extending off into the buffer, OR the
  294.            short integer which is the resource ID of the icon or picture assocaited with
  295.            the item. }
  296.         CASE integer OF 
  297.             1: (text_buf        :SignedByte);    { static, edit, or control title text }
  298.             2: (item_text_ptr    :^SignedByte);
  299.             3: (itemResID        :integer);
  300.             4: (text_name: Str255);    { this type is not defined by the mole, 
  301.                                     its here for the convenience of Pascal programmers. }
  302.     END; 
  303.     MoleDItemInfoPtr = ^MoleDItemInfo;
  304.  
  305.  
  306. { ----------------- Menu related data structures --------------------}
  307.  
  308. TYPE
  309.     SendMenuInfoParams = RECORD
  310.         menu_rank            :integer;        { left-to-right rank in menu bar }
  311.         menu_ID                :integer;        { ID of menu, if known }
  312.     END;
  313.     SendMenuInfoParamsPtr = ^SendMenuInfoParams;
  314.  
  315.     MoleMenuInfo = RECORD
  316.         num_items            :longint;        { number of items in the menu }
  317.         rank                :longint;        { in menu bar, left to right }
  318.         left_edge            :longint;        { as extracted from the menu list field }
  319.         menuID                :integer;        { menu ID as known to the menu manager }
  320.         menuWidth            :integer;        { assuming a rectangular menu, the width in pixels
  321.                                                    NOT the position on the screen! }
  322.         menuHeight            :integer;        { assuming a rectangular menu, the height in pixels
  323.                                                    NOT the position on the screen! }
  324.         enableFlags            :longint;        { Least significant bit is one if the menu iteself is 
  325.                                                    enabled.  Other bits describe the enabled state of 
  326.                                                 the first 31 items }
  327.          { the menu field either has a pointer to the menu title as a pascal string,
  328.            or the text of the menu title extending off into the buffer }
  329.         CASE integer OF 
  330.             1: (Data            :^SignedByte);
  331.             2: (title_text        :SignedByte);    
  332.             3: (text_name: Str255);    { this type is not defined by the mole, 
  333.                                     its here for the convenience of Pascal programmers. }
  334.     END; 
  335.     MoleMenuInfoPtr = ^MoleMenuInfo;
  336.         
  337.     SendMenuItemsParams = RECORD
  338.         menu_rank            :integer;        { left-to-right rank in menu bar }
  339.         menu_ID                :integer;        { ID of menu, if known }
  340.         start_item            :integer;        { rank of item in menu to start the block with }
  341.         stop_item            :integer;        { rank of last item in the menu we are interested in }
  342.     END;
  343.     SendMenuItemsParamsPtr = ^SendMenuItemsParams;
  344.  
  345.  
  346.  
  347. { ----------------- Mole data block structures --------------------}
  348.  
  349. CONST
  350.     MOLE_DATA_BLOCKSIZE = 512;                { a nice, arbitrary, round number }
  351.     ADDITIONAL_MENU_ITEM_DATA = 5;            { bytes in a menu item subrec in addition to 
  352.                                               the text of the menu item (don't ask, its ugly) }
  353. TYPE
  354.     MoleDataBlock = RECORD
  355.         blockLength            :integer;        { blockLength }
  356.         dataBlock            :PACKED ARRAY [0..MOLE_DATA_BLOCKSIZE-1] OF char;    
  357.         { the returned packet will only be a long as needed to send the requested data }
  358.     END;
  359.     MoleDataBlockPtr = ^MoleDataBlock;
  360.  
  361.